package com.elink.enginerring.to;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.elink.enginerring.common.Constant;
import com.elink.enginerring.user.entity.User;
import com.elink.enginerring.user.entity.UserRole;
import com.elink.enginerring.user.service.IUserService;

/**
 * 页面跳转
 * @author hxjxiaojun
 *
 */
@Controller
@RequestMapping(method=RequestMethod.GET)
public class ToController {
	@Autowired
	private IUserService userService;
	
	/**
	 * 跳转到后台主页
	 * @return
	 */
	@RequestMapping("index.htm")
	@SuppressWarnings("unchecked")
	public String toIndex(HttpServletRequest request){
		User user=(User)request.getSession().getAttribute(Constant.su_in_session);
		List<UserRole>	 role =     (List<UserRole>) request.getSession().getAttribute(Constant.role_in_session);
		request.setAttribute("user", user);
		request.setAttribute("role", role);
		return "index";
	}
	
	/**
	 * 跳转到词典页面
	 * @return
	 */
	@RequestMapping("dict.htm")
	public String toDict(){
		return "dict/dict_list";
	}
	
	/**
	 * 跳转到百问百答列表页
	 * @return
	 */
	@RequestMapping("postbar.htm")
	public String toPostbar(){
		return "postbar/postbar_list";
	}
	/**
	 * 跳转到企业列表
	 * @return
	 */
	@RequestMapping("company.htm")
	public String toCompany(){
		return "company/company_list";
	}
	/**
	 * 添加资料
	 * @return
	 */
	@RequestMapping("file/add.htm")
	public String toAddFile(){
		return "file/add_file";
	}
	
	/**
	 * 添加职业考证资料
	 * @return
	 */
	@RequestMapping("file/addCert.htm")
	public String toAddCert(){
		return "file/add_cert";
	}

	/**
	 * 添加建筑类别
	 * @return
	 */
	@RequestMapping("file/addBuild.htm")
	public String toAddBuild(){
		return "file/add_build";
	}
	/**
	 * 跳转到工程资料列表页
	 * @return
	 */
	@RequestMapping("file.htm")
	public String toFileList(){
		return "file/file_list";
	}
	
	/**
	 * 跳转到职业考证列表页
	 * @return
	 */
	@RequestMapping("cert.htm")
	public String toCert(){
		return "file/cert_list";
	}
	/**
	 * 跳转到建筑类列表页
	 * @return
	 */
	@RequestMapping("build.htm")
	public String toBuild(){
		return "file/build_list";
	}
	/**
	 * 跳转到工程技能体系
	 * @return
	 */
	@RequestMapping("skill.htm")
	public String toSkill(){
		return "skill/skill_list";
	}
	
	/**
	 * 跳转到职业规划体系
	 * @return
	 */
	@RequestMapping("plan.htm")
	public String toPlan(){
		return "plan/plan_list";
	}
	
	/**
	 * 添加职业规划体系--资料
	 * @return
	 */
	@RequestMapping("plan/addFile.htm")
	public String toAddPlanFile(HttpServletRequest request){
		request.setAttribute("hierId", request.getParameter("hierId"));
		return "plan/add_file";
	}
	/**
	 * 跳转到工程资料库资料列表页
	 * @return
	 */
	@RequestMapping("database.htm")
	public String toDatabase(){
		return "file/database_file_list";
	}
	/**
	 * 跳转到课程列表
	 * @return
	 */
	@RequestMapping("course.htm")
	public String toCourse(){
		return "course/course_list";
	}
	
	/**
	 * 添加课程
	 * @return
	 */
	@RequestMapping("course/addCourse.htm")
	public String toAddCourse(){
	//	request.setAttribute("courseId", request.getParameter("courseId"));
		return "course/add_course";
	}
	/**
	 * 添加课程--章节
	 * @return
	 */
	@RequestMapping("course/addChapter.htm")
	public String toaddChapter(HttpServletRequest request){
		request.setAttribute("courseId", request.getParameter("courseId"));
		return "course/add_chapter";
	}
	/**
	 * 添加课程--视频
	 * @return
	 */
	@RequestMapping("course/addVideo.htm")
	public String toAddVideo(HttpServletRequest request){
		request.setAttribute("courseId", request.getParameter("courseId"));
		return "course/add_video";
	}
	/**
	 * 添加工程技能体系--资料
	 * @return
	 */
	@RequestMapping("skill/addFile.htm")
	public String toAddSkillFile(HttpServletRequest request){
		request.setAttribute("skillId", request.getParameter("skillId"));
		return "skill/add_file";
	}
	
	/**
	 * 添加工程技能体系--资料
	 * @return
	 */
	@RequestMapping("skill/fileList.htm")
	public String toSkillFileList(HttpServletRequest request){
		request.setAttribute("skillId", request.getParameter("skillId"));
		request.setAttribute("title", request.getParameter("title"));
		return "skill/file_list";
	}
	
	/**
	 * 添加工程技能体系--视频
	 * @return
	 */
	@RequestMapping("skill/addVideo.htm")
	public String toAddSkillVideo(HttpServletRequest request){
		request.setAttribute("skillId", request.getAttribute("skillId"));
		return "skill/add_video";
	}
	
	/**
	 * 跳转到新闻列表页
	 * @return
	 */
	@RequestMapping("news.htm")
	public String toNewsList(){
		return "news/news_list";
	}
	/**
	 * 跳转文件分类列表页
	 * @return
	 */
	@RequestMapping("topCategory.htm")
	public String toCategory(){
		return "category/top";
	}
	
	/**
	 * 跳转文件格式列表页
	 * @return
	 */
	@RequestMapping("file/type.htm")
	public String toFileType(){
		return "file/type_list";
	}
	
	/**
	 * 跳转论文格式列表页
	 * @return
	 */
	@RequestMapping("thesis/type.htm")
	public String toThesisType(){
		return "thesis/type_list";
	}
	
	/**
	 * 添加论文
	 * @return
	 */
	@RequestMapping("thesis/add.htm")
	public String toAddThesis(){
		return "thesis/add_thesis";
	}
	
	/**
	 * 跳转新闻分类列表页
	 * @return
	 */
	@RequestMapping("news/type.htm")
	public String toNewsType(){
		return "news/type_list";
	}
	
	/**
	 * 跳转文件标签列表页
	 * @return
	 */
	@RequestMapping("file/tag.htm")
	public String toFileTag(){
		return "file/tag_list";
	}
	
	/**
	 * 跳转论文标签列表页
	 * @return
	 */
	@RequestMapping("thesis/tag.htm")
	public String toThesisTag(){
		return "thesis/tag_list";
	}
	
	/**
	 * 跳转新闻标签列表页
	 * @return
	 */
	@RequestMapping("news/tag.htm")
	public String toNewsTag(){
		return "news/tag_list";
	}
	/**
	 * 跳转到文件评论列表页
	 * @return
	 */
	@RequestMapping("file/comment.htm")
	public String toFileComment(){
		return "file/comment_list";
	}
	
	/**
	 * 跳转到论文评论列表页
	 * @return
	 */
	@RequestMapping("thesis/comment.htm")
	public String toThesisComment(){
		return "thesis/comment_list";
	}
	/**
	 * 跳转到新闻评论列表页
	 * @return
	 */
	@RequestMapping("news/comment.htm")
	public String toNewsComment(){
		return "news/comment_list";
	}
	
	
	/**
	 * 跳转到工程资料列表页
	 * @return
	 */
	@RequestMapping("thesis.htm")
	public String toThesisList(){
		return "thesis/thesis_list";
	}
	
	
	/**
	 * 跳转到用户管理页
	 * @return
	 */
	@RequestMapping("user.htm")
	public String toUserList(){
		return "user/list";
	}
	
	
	/**
	 * 跳转到系统用户管理页面
	 * @return
	 */
	@RequestMapping("sysuser.htm")
	public String toSysUser(){
		return "setting/sysuser";
	}
	/**
	 * 跳转到修改密码页面
	 * @return
	 */
	@RequestMapping("changepw.htm")
	public String toChangepw(){
		return "setting/changepw";
	}
	
	/**
	 * 有关我们
	 * @return
	 */
	@RequestMapping("about.htm")
	public String about(){
		return "about";
	}
	/**
	 * 意见反馈
	 * @return
	 */
	@RequestMapping("feedback.htm")
	public String feedback(){
		return "feedback";
	}
	/**
	 * 跳转到专题
	 * @return
	 */
	@RequestMapping("subject.htm")
	public String toSubject(){
		return "subject/subject_list";
	}
	
	/**
	 * 专题--目录
	 * @return
	 */
	@RequestMapping("catalog.htm")
	public String toCatalog(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		return "subject/catalog_list";
	}
	
	
	/**
	 * 目录--资料
	 * @return
	 */
	@RequestMapping("subjectFile.htm")
	public String toSubjectFile(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/subjectFile_list";
	}
	/**
	 * 添加资料
	 * @return
	 */
	@RequestMapping("subject/addSubjectFile.htm")
	public String toAddSubjectFile(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/add_subject_file";
	}
	/**
	 * 目录--头条
	 * @return
	 */
	@RequestMapping("subjectNews.htm")
	public String toSubjectNews(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/subjectNews_list";
	}
	
	/**
	 * 添加头条
	 * @return
	 */
	@RequestMapping("subject/addSubjectNews.htm")
	public String toAddSubjectNews(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/add_subject_news";
	}
	/**
	 * 目录--博文
	 * @return
	 */
	@RequestMapping("subjectBlog.htm")
	public String toSubjectBlog(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/subjectBlog_list";
	}
	
	/**
	 * 添加博文
	 * @return
	 */
	@RequestMapping("subject/addSubjectBlog.htm")
	public String toAddSubjectBlog(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/add_subject_blog";
	}
	/**
	 * 目录--课程
	 * @return
	 */
	@RequestMapping("subjectCourse.htm")
	public String toSubjectCourse(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/subjectCourse_list";
	}
	/**
	 * 添加课程
	 * @return
	 */
	@RequestMapping("subject/addSubjectCourse.htm")
	public String toAddSubjectCourse(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/add_subject_course";
	}
	
	/**
	 * 目录--百问百答
	 * @return
	 */
	@RequestMapping("subjectPostbar.htm")
	public String toSubjectPostbar(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/subjectPostbar_list";
	}
	/**
	 * 添加百问百答
	 * @return
	 */
	@RequestMapping("subject/addSubjectPostbar.htm")
	public String toAddSubjectPostbar(HttpServletRequest request){
		request.setAttribute("subjectId", request.getParameter("subjectId"));
		request.setAttribute("subjectName", request.getParameter("subjectName"));
		request.setAttribute("catalogId", request.getParameter("catalogId"));
		request.setAttribute("catalogName", request.getParameter("catalogName"));
		return "subject/add_subject_postbar";
	}
}